/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bookingtickets;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author alexxxey
 */
@Embeddable
public class TicketPK implements Serializable
{
    @Basic(optional = false)
    @NotNull
    @Column(name = "TRIPID")
    private int tripid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PLACE")
    private int place;

    public TicketPK()
    {
    }

    public TicketPK(int tripid, int place)
    {
        this.tripid = tripid;
        this.place = place;
    }

    public int getTripid()
    {
        return tripid;
    }

    public void setTripid(int tripid)
    {
        this.tripid = tripid;
    }

    public int getPlace()
    {
        return place;
    }

    public void setPlace(int place)
    {
        this.place = place;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (int) tripid;
        hash += (int) place;
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TicketPK))
        {
            return false;
        }
        TicketPK other = (TicketPK) object;
        if (this.tripid != other.tripid)
        {
            return false;
        }
        if (this.place != other.place)
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "bookingtickets.TicketPK[ tripid=" + tripid + ", place=" + place + " ]";
    }
    
}
